/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package de.schmitt.marc.msRetailManager.gui;

import de.schmitt.marc.msRetailManager.api.Service;
import java.awt.HeadlessException;
import java.io.OutputStream;
import java.io.PrintStream;

/**
 *
 * @author schmitt
 */
public class MainWindow extends javax.swing.JFrame {
    private Service service = null;
    private PrintStream logger = System.out;

    public MainWindow() throws HeadlessException {
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        initComponents();
        setVisible(true);
    }

    /**
     * Creates new form MainWindow
     */
    public MainWindow(Service service, PrintStream log) {
        this();
        this.service = service;
        this.logger = log;
        
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        header = new javax.swing.JPanel();
        hText = new javax.swing.JLabel();
        center = new javax.swing.JPanel();
        Welcome = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        barVerkauf = new javax.swing.JPanel();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jTextField2 = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        jList1 = new javax.swing.JList();
        jButton3 = new javax.swing.JButton();
        jSpinner1 = new javax.swing.JSpinner();
        jButton4 = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jList2 = new javax.swing.JList();
        menu = new javax.swing.JMenuBar();
        mVerkauf = new javax.swing.JMenu();
        mVerakaufBar = new javax.swing.JMenuItem();
        mVerkaufVorbest = new javax.swing.JMenuItem();
        mVerkaufReserv = new javax.swing.JMenuItem();
        mEinkauf = new javax.swing.JMenu();
        mEinkaufEintragen = new javax.swing.JMenuItem();
        mEinkaufVorm = new javax.swing.JMenuItem();
        mEinkaufDauer = new javax.swing.JMenuItem();
        mLager = new javax.swing.JMenu();
        mLagerAbschreibung = new javax.swing.JMenuItem();
        mLagerInventur = new javax.swing.JMenuItem();
        mAnalyse = new javax.swing.JMenu();
        mAnalyseGuV = new javax.swing.JMenuItem();
        mInfos = new javax.swing.JMenu();
        mInfosVersion = new javax.swing.JMenuItem();
        mInfosHilfe = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("ms-retail-manager");
        setPreferredSize(new java.awt.Dimension(600, 400));

        header.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        header.setAlignmentX(1.0F);
        header.setAlignmentY(1.0F);

        hText.setFont(hText.getFont().deriveFont(hText.getFont().getStyle() | java.awt.Font.BOLD, hText.getFont().getSize()+20));
        hText.setText("Mein Kerzenladen V0.2");

        javax.swing.GroupLayout headerLayout = new javax.swing.GroupLayout(header);
        header.setLayout(headerLayout);
        headerLayout.setHorizontalGroup(
            headerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(hText, javax.swing.GroupLayout.DEFAULT_SIZE, 606, Short.MAX_VALUE)
        );
        headerLayout.setVerticalGroup(
            headerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(hText, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        getContentPane().add(header, java.awt.BorderLayout.NORTH);

        center.setLayout(new java.awt.CardLayout());

        Welcome.setToolTipText("");

        jTextArea1.setEditable(false);
        jTextArea1.setColumns(20);
        jTextArea1.setRows(5);
        jTextArea1.setText("Wilkommen,\ndiese Version ist eine sehr frühe Entwicklungsversion \ndie als Beispiel gelten soll.\n\nEs werden Keine daten dauerhaft gespeichert \nnoch sind alle Knöpfe mit einer Funktion versehen.\nDiese Version soll als Veranschaulichung dienen \nund soll auch zur Kritik anregen.\n\n\nAllgemeine Informationen:\n- Das Programm wird über die Kopfleiste gesteuert.\n\n"); // NOI18N
        jTextArea1.setWrapStyleWord(true);
        Welcome.setViewportView(jTextArea1);

        center.add(Welcome, "Welcome");

        jButton1.setText("jButton1");

        jButton2.setText("jButton2");

        jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        jLabel1.setText("Produktsuche");

        jLabel2.setText("Name");

        jTextField1.setText("jTextField1");
        jTextField1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextField1ActionPerformed(evt);
            }
        });

        jLabel3.setText("Preis");

        jTextField2.setText("jTextField2");

        jList1.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane1.setViewportView(jList1);

        jButton3.setText("Suchen");

        jButton4.setText("->");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jButton3))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 131, Short.MAX_VALUE)
                        .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(60, 60, 60)))
                .addGap(26, 26, 26)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jButton4))
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2)
                            .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(9, 9, 9)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3)
                            .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton3)))
                .addContainerGap(14, Short.MAX_VALUE))
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        jLabel4.setText("Einkaufswagen");

        jList2.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane2.setViewportView(jList2);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane2)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel4)
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout barVerkaufLayout = new javax.swing.GroupLayout(barVerkauf);
        barVerkauf.setLayout(barVerkaufLayout);
        barVerkaufLayout.setHorizontalGroup(
            barVerkaufLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(barVerkaufLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(barVerkaufLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(barVerkaufLayout.createSequentialGroup()
                        .addComponent(jButton2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jButton1))
                    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        barVerkaufLayout.setVerticalGroup(
            barVerkaufLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, barVerkaufLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 43, Short.MAX_VALUE)
                .addGroup(barVerkaufLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton1)
                    .addComponent(jButton2))
                .addGap(26, 26, 26))
        );

        center.add(barVerkauf, "verkaufBar");

        getContentPane().add(center, java.awt.BorderLayout.CENTER);

        menu.setPreferredSize(new java.awt.Dimension(640, 21));

        mVerkauf.setText("Verkauf");

        mVerakaufBar.setText("Barverkauf");
        mVerakaufBar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mVerakaufBarActionPerformed(evt);
            }
        });
        mVerkauf.add(mVerakaufBar);

        mVerkaufVorbest.setText("Vorbestellung");
        mVerkauf.add(mVerkaufVorbest);

        mVerkaufReserv.setText("Reservierung");
        mVerkauf.add(mVerkaufReserv);

        menu.add(mVerkauf);

        mEinkauf.setText("Einkauf");

        mEinkaufEintragen.setText("Eintragen");
        mEinkauf.add(mEinkaufEintragen);

        mEinkaufVorm.setText("Vormerken");
        mEinkauf.add(mEinkaufVorm);

        mEinkaufDauer.setText("Dauerauftragverw.");
        mEinkauf.add(mEinkaufDauer);

        menu.add(mEinkauf);

        mLager.setText("Lager");

        mLagerAbschreibung.setText("Abschreibung");
        mLager.add(mLagerAbschreibung);

        mLagerInventur.setText("Inventur");
        mLager.add(mLagerInventur);

        menu.add(mLager);

        mAnalyse.setText("Analyse");

        mAnalyseGuV.setText("Gewinn und Verlusst");
        mAnalyse.add(mAnalyseGuV);

        menu.add(mAnalyse);

        mInfos.setText("Infos");

        mInfosVersion.setText("Version");
        mInfos.add(mInfosVersion);

        mInfosHilfe.setText("Hilfe");
        mInfos.add(mInfosHilfe);

        menu.add(mInfos);

        setJMenuBar(menu);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void mVerakaufBarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mVerakaufBarActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_mVerakaufBarActionPerformed

    private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextField1ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new MainWindow().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JScrollPane Welcome;
    private javax.swing.JPanel barVerkauf;
    private javax.swing.JPanel center;
    private javax.swing.JLabel hText;
    private javax.swing.JPanel header;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JList jList1;
    private javax.swing.JList jList2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JSpinner jSpinner1;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JMenu mAnalyse;
    private javax.swing.JMenuItem mAnalyseGuV;
    private javax.swing.JMenu mEinkauf;
    private javax.swing.JMenuItem mEinkaufDauer;
    private javax.swing.JMenuItem mEinkaufEintragen;
    private javax.swing.JMenuItem mEinkaufVorm;
    private javax.swing.JMenu mInfos;
    private javax.swing.JMenuItem mInfosHilfe;
    private javax.swing.JMenuItem mInfosVersion;
    private javax.swing.JMenu mLager;
    private javax.swing.JMenuItem mLagerAbschreibung;
    private javax.swing.JMenuItem mLagerInventur;
    private javax.swing.JMenuItem mVerakaufBar;
    private javax.swing.JMenu mVerkauf;
    private javax.swing.JMenuItem mVerkaufReserv;
    private javax.swing.JMenuItem mVerkaufVorbest;
    private javax.swing.JMenuBar menu;
    // End of variables declaration//GEN-END:variables
}
